import { http } from "@/utils/http";

//引入类型约束
import type { loginResponse } from "@/types/login";

/**
 * 微信小程序快捷登录
 * @param code wx.login()返回的状态码
 * @param encryptedData @getphonenumber返回的detail信息
 * @param iv @getphonenumber返回的detail信息
 */
export const reqLogin = (code:string,encryptedData:string,iv:string) => {
    return http<loginResponse>({
        url:"/login/wxMin",
        method:"POST",
        data:{
            code,
            encryptedData,
            iv
        }
    })
}

/**
 * 模拟快捷登录
 * @param phone 模拟手机号码
 * @returns 
 */
export const reqLoginSimple = (phone:string) => {
    return http<loginResponse>({
        url:"/login/wxMin/simple",
        method:"POST",
        data:{phoneNumber:phone}
    })
}

